package com.vr.xuecheng.feign.fallback;

import com.vr.xuecheng.feign.client.ContentClient;
import com.vr.xuecheng.feign.dto.TeachPlanOfFeignDTO;
import lombok.extern.log4j.Log4j2;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author hzh
 * @date 2025/04/11
 */
@Log4j2
@Component
public class ContentFallbackFactory implements FallbackFactory<ContentClient> {
    @Override
    public ContentClient create(Throwable cause) {
        return new ContentClient() {

            @Override
            public TeachPlanOfFeignDTO getTeachPlanById(Long teachplanId) {
                log.error("调用内容服务，获取教学计划失败：{}",cause.getMessage());
                return null;
            }
        };
    }
}
